import re
import requests

import aliyunsdkcore


def getip(url):
    req = requests.get(url)
    result = req.text
    ipaddr = re.findall(r"\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b", result)
    if ipaddr:
        return ipaddr








if __name__ == "__main__":

    url = "http://attacker.club/getip"  # 域名
    # url = "http://ipinfo.io"


    try:
        IP = getip(url)
    except Exception as e:
        print(e)

    else:
        print(IP)






